<template>
  <div class="container">
    <el-row type="flex" justify="space-between">
      <!-- 订单表单 -->
      <div class="main">
        <OrderForm
          v-if="ticketData"
          :data="ticketData"
          @setTotalPrice="setTotalPrice"
          @userLength="userLength"
        />
      </div>

      <!-- 侧边栏 -->
      <div class="aside">
        <OrderAside v-if="ticketData" :data="ticketData" :totalPrice="totalPrice" :users="users" />
      </div>
    </el-row>
  </div>
</template>

<script>
import OrderForm from "@/components/air/orderForm";
import OrderAside from "@/components/air/orderAside";
export default {
  components: {
    OrderForm,
    OrderAside
  },
  data() {
    return {
      ticketData: null,
      totalPrice: 0,
      users: 0
    };
  },
  mounted() {
    this.$axios({
      url: "/airs/" + this.$route.query.id,
      params: {
        seat_xid: this.$route.query.seat_xid
      }
    }).then(res => {
      // console.log(res.data);
      this.ticketData = res.data;
      console.log(this.ticketData);
    });
  },
  methods: {
    setTotalPrice(newTotalPrice) {
      this.totalPrice = newTotalPrice;
    },
    userLength(newUsers) {
      this.users = newUsers;
    }
  }
};
</script>

<style lang="less" scoped>
.container {
  width: 1000px;
  margin: 20px auto;
}

/*aside*/
.aside {
  width: 350px;
  height: fit-content;
  border: 1px #ddd solid;
}
</style>